package com.south.base.test;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;

/**
 * @author Administrator
 * @date 2019/12/4 17:55
 */
public class OffDutyTimer {
    /**
     *
     * @param args 24小时 分钟
     */
    public static void main(String[] args) {
        boolean f = true;
        while (f) {
            LocalTime localTime = LocalTime.of(Integer.valueOf(args[0]), Integer.valueOf(args[1]), 0, 0);
            LocalTime now = LocalTime.now();
            if (localTime.isBefore(now)) {
                f = false;
            }
            System.out.println(localTime.minus(now.getHour(), ChronoUnit.HOURS).minus(now.getMinute(), ChronoUnit.MINUTES).minus(now.getSecond(), ChronoUnit.SECONDS).format(DateTimeFormatter.ofPattern("HH时m分s秒")));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
